#!/usr/bin/env python
# coding=utf-8
# @FileName  :qst_create_resp_schemas.py
# @Time      :2024/6/1 18:57
# @Author    :jdz

def base_response(code, msg, data=None):
    """基础返回格式"""
    if data is None:
        data = []
    result = {
        "code": code,
        "msg": msg,
        "data": data
    }
    return result


def success(data=None, msg='响应成功', code=200):
    if msg is None:
        msg = '响应成功'
    if code is None:
        code = 200
    """成功返回格式"""
    return base_response(code, msg, data)


def fail(code=-1, msg='', data=None):
    """失败返回格式"""
    return base_response(code, msg, data)
